<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script  runat="server">
Sub Page_Load(sender As Object, e As EventArgs)	
	Try
	Dim myConnection As New SqlConnection()
    	myConnection.ConnectionString = "server=localhost;" & _
	"UID=sa;PWD=aido;database=intershop;Connect Timeout=30"
    	myConnection.Open()
	 AddHandler myConnection.InfoMessage, New SqlInfoMessageEventHandler(AddressOf OnInfoMessage)	
	Catch objError As Exception
		Response.Write("<b>* Error Message</b>: " & _
		objError.Message & "<p />")	
		
	End Try
End Sub

Private Shared Sub OnInfoMessage(sender As Object, args As SqlInfoMessageEventArgs)
  Dim err As SqlError
  For Each err In args.Errors
	Console.WriteLine("The {0} has received a severity {1}, state {2} error number {3}\n" & _
                      "on line {4} of procedure {5} on server {6}:\n{7}", _
                      err.Source, err.Class, err.State, err.Number, err.LineNumber, _
                      err.Procedure, err.Server, err.Message)


  Next
End Sub

</script>	
